{% extends "base_generic.html" %}

{% block content %}
  <div class="card">
    <h1>全部借阅图书</h1>

    {% if bookinstance_list %}
      <ul class="list-group">
        {% for bookinst in bookinstance_list %}
          <li class="list-group-item {% if bookinst.is_overdue %}list-group-item-danger{% endif %}">
            <a href="{% url 'book-detail' bookinst.book.pk %}" class="btn btn-main btn-sm">{{ bookinst.book.title }}</a>
            <span class="text-muted">（应归还日期: {{ bookinst.due_back }}）</span>
            <p style="margin-top: 5px; margin-bottom: 0;"><strong>借阅者:</strong> {{ bookinst.borrower.get_username }}</p>
            {% if perms.catalog.can_mark_returned %}
              <a href="{% url 'renew-book-librarian' bookinst.id %}" class="btn btn-primary btn-sm" style="margin-top: 10px;">续借</a>
            {% endif %}
          </li>
        {% endfor %}
      </ul>
    {% else %}
      <p>当前没有图书被借阅。</p>
    {% endif %}
  </div>
{% endblock %}